package testJob;

import java.util.Arrays;

public class Tester {
	public static void main(String[] args) {
//		ShellJob1 j1 = new ShellJob1("new data");
//		j1.run();
//		System.out.println("The ShellJob name is: "+j1.getData()+"\nthe spend time is:"+j1.getDuration());
//	

		ShellJobForJson job = new ShellJobForJson("Json data");
//		job.run();
//		System.out.println("The ShellJob name is: "+job.getData()+
//				"\nthe ShellJob result is: "+Arrays.toString(job.getResult())+
//				"\nthe spend time is:"+job.getDuration()+"\n");
	
		ShellJobForIntArray j2 = new ShellJobForIntArray(new int[]{2,5,0});
//		j2.run();
//		int i = j2.rudation;
//		System.out.println("The ShellJob name is: "+Arrays.toString(j2.getData())+
//				"\nthe ShellJob result is: "+Arrays.toString(j2.getResult())+
//				"\nthe spend time is:"+j2.getDuration()+"\n");
		
		PythonJob j3 = new PythonJob("<Python Path>",new String[] {"121135","whf15"});
//		j3.run();
//		int i = j2.rudation;
//		System.out.println("The ShellJob Path is: "+j3.getPythonPath()+
//				"\nthe ShellJob Files is: "+Arrays.toString(j3.getFiles())+
//				"\nthe ShellJob result is: "+Arrays.toString(j3.getResult())+
//				"\nthe spend time is:"+j3.getDuration()+"\n");
		
		
		
		SQLJob j4 = new SQLJob("192.168.1.1", 6379, "<test Connect>","SELECT * FROM TABLE;");
		if(j4.ping(10000)) {
//			j4.run();
//			System.out.println("The SQL is: "+j4.getSql()+
//					"\nthe spend time is:"+j4.getDuration());
		}
		
		
		FileServerJob j5 = new FileServerJob("192.168.1.2", 88, "<test Connect>",new String[] {"whf15","2018181829"});
		if(j5.ping(10000)) {
//			j5.run();
//			System.out.println("The FileServer is: "+Arrays.toString(j5.getFiles())+
//					"\nthe spend time is:"+j5.getDuration());
			
		}
		
		HadoopJob j6 = new HadoopJob("192.168.1.2", 888, "<test schedule>");
//		j6.run();
//		System.out.println("The HadoopJob Result is: "+Arrays.toString(j6.getResult())+
//				"\nthe spend time is:"+j6.getDuration());
//			
		
		JobRunner r1 = new JobRunner(new CaclJob[] {job,j2,j3,j4,j5,j6} );
		r1.runAllJobs();
		
	}
}
